<template>
	<view class="My">
		<view class="my-nav">
			<view class="nav-status" :style="{height:ktxStatusHeight}"></view>
			<view class="nav" :style="{height:navigationHeight}"></view>
			<view class="my-info">
				<view>
					<view class="header-bg">
						<uni-icons type="headphones" size="30" color="#17adf0"></uni-icons>
					</view>
				</view>
				<view class="my-nickname">威大头1711</view>
			</view>
		</view>
		<view class="my-operator">
			<view class="my-operator-item" @click="toOrderList">
				<view>
					<uni-icons type="shop" size="30"></uni-icons>
				</view>
				<view>我的订单</view>
			</view>
			<view class="my-operator-item">
				<view>
					<uni-icons type="staff" size="30"></uni-icons>
				</view>
				<view>联系人</view>
			</view>
			<view class="my-operator-item">
				<view>
					<uni-icons type="star-filled" size="30"></uni-icons>
				</view>
				<view>会员Vip</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		onMounted,
		ref
	} from 'vue';
	let ktxStatusHeight = ref(0); // 状态栏高度
	let navigationHeight = ref(0); // 导航栏的高度
	onMounted(() => {
		const systemInfo = uni.getSystemInfoSync()
		console.log(systemInfo)
		// px转换到rpx的比例
		let pxToRpxScale = 750 / systemInfo.windowWidth;
		// console.log(pxToRpxScale)
		ktxStatusHeight.value = systemInfo.statusBarHeight * pxToRpxScale + 'rpx';
		navigationHeight.value = 44 * pxToRpxScale + 'rpx';
		// console.log(systemInfo.statusBarHeight * pxToRpxScale)
		// console.log(44 * pxToRpxScale)
	})
	const toOrderList = () => {
		uni.navigateTo({
			url: '/pages/my/orderList/orderList'
		})
	}
</script>

<style lang="scss">
	.My {
		.my-nav {
			background: #17adf0;

			.my-info {
				color: #fff;

				.header-bg {
					background: #fff;
					width: 120rpx;
					height: 120rpx;
					display: flex;
					justify-content: center;
					align-items: center;
					border-radius: 50%;
					position: relative;
					left: 50%;
					transform: translateX(-50%);
				}

				text-align: center;

				.my-nickname {
					font-weight: bold;
					font-size: 32rpx;
					padding: 30rpx 0;
				}
			}
		}

		.my-operator {
			margin-top: 20rpx;
			display: grid;
			grid-template-columns: 1fr 1fr 1fr;
			text-align: center;

			.my-operator-item {
				width: 100%;
			}
		}
	}
</style>
